package net.hanjava.test.lock;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

public class LockExam9 {
	public static void main(String[] args) throws IOException {
		FileOutputStream fos = new FileOutputStream(LockExam1.PATH, true);
		FileChannel ch = fos.getChannel();
		ch.lock();
//		FileChannel ch = raf.getChannel();
//		System.err.println("Trying to lock from RandomAccessFile");
//		
//		FileLock lock = ch.lock(0, Long.MAX_VALUE, false);
//		System.err.println("Got a lock");
		LockExam1.pause();
		fos.close();
	}
}